<?php
namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;
use App\Models\Organization;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;

class OrganizationController extends Controller
{
  public function all(Request $request){
    $queryBuild = Organization::query();
    $province_adcode = $request->input('province_adcode');
    if($province_adcode){
      $queryBuild->where('province_adcode',$province_adcode);
    }
    $list = $queryBuild->get();
    return new ResourceCollection($list);
  }
}